Skip to content

Parse extractAsUint256 values as unsigned decimal integers - #4894

Merged
masih merged 1 commit into
mainfrom
masih/1794907195-json-uint256-digits
Nov 17, 2026
Merged

masih merged 1 commit into
mainfrom
masih/1794907195-json-uint256-digits

Conversation

@masih

@masih masih commented Nov 17, 2026 •

Copy link
Copy Markdown
Collaborator

extractAsUint256 on the JSON precompile parsed its value with big.Int.SetString, which takes a wider input grammar than the unsigned uint256 the method returns.

ExtractAsUint256 now accepts only a plain string of decimal digits, quoted or unquoted, and returns an error for any other form. Gas and the 100-character length cap are unchanged.

Inputs outside that form now revert where they previously returned a value, so this is app-hash-breaking. Covered by the extended TestExtractAsUint256.

@github-actions

Copy link
Copy Markdown

The latest Buf updates on your PR. Results from workflow Buf / buf (pull_request).

BuildFormatLintBreakingUpdated (UTC)
✅ passed✅ passed✅ passed✅ passedNov 17, 2026, 9:25 AM

@masih
masih marked this pull request as ready for review November 17, 2026 09:26
@cursor

cursor Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

PR Summary

High Risk
EVM JSON precompile parsing changes are consensus-breaking; transactions that previously succeeded on signed or non-digit values will now revert.

Overview
Tightens extractAsUint256 on the JSON precompile so values must be unsigned decimal integers (digits only after trimming JSON quotes), instead of accepting whatever big.Int.SetString allows (e.g. signs).

Invalid inputs—negative numbers, + prefixes, non-digit characters—now error with a clearer parse message. Valid quoted strings, unquoted JSON numbers, and zero still work; the 100-character cap and gas behavior are unchanged.

TestExtractAsUint256 adds success and failure cases for these forms. This is consensus-breaking for calls that previously succeeded on signed or oddly formatted values.

Reviewed by Cursor Bugbot for commit ca82fd2. Bugbot is set up for automated code reviews on this repo. Configure here.

@codecov

codecov Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 61.62%. Comparing base (c7d841c) to head (ca82fd2).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #4894      +/-   ##
==========================================
- Coverage   61.62%   61.62%   -0.01%     
==========================================
  Files        2080     2080              
  Lines      162041   162041              
==========================================
- Hits        99865    99862       -3     
- Misses      62171    62174       +3     
  Partials        5        5              
Flag Coverage Δ
sei-chain 59.82% <100.00%> (-0.01%) ⬇️
sei-db 75.17% <ø> (ø)
sei-db-state-db 81.59% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
precompiles/json/json.go 82.47% <100.00%> (+1.03%) ⬆️

... and 23 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@seidroid seidroid Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change makes extractAsUint256 on the JSON precompile reject a leading + or - sign. Before, big.Int.SetString accepted signed input and FillBytes then returned the absolute value, so "-1" came back as 1. The new digits-only check closes the only extra forms that base-10 SetString allowed, and nothing blocks (reviewed against the PR merge tree; no Go toolchain was available, so the test was not run). Scout codex reported no findings, and that matches this review; it had no claims to keep or drop.

seidroid review · decision approve · session 5c10ecb0905d4281a42699eccda588c6 · turn resp_claude_cab9c177f39afd710318952f7a5d7c98 · item 0a7196227c5858959ccb2d1d8ad47a32

Findings: 0 blocking | 0 non-blocking | 0 posted inline

@masih
masih requested review from manav2401 and sei-will November 17, 2026 09:44
@masih
masih added this pull request to the merge queue Nov 17, 2026
Merged via the queue into main with commit 37abd47 Nov 17, 2026
85 of 88 checks passed
@masih
masih deleted the masih/1794907195-json-uint256-digits branch November 17, 2026 10:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants